package top.chj.day16.zhengze;

import org.junit.Test;

/**
 * @Auther:小陈的Java
 */
public class RegexDemo {
    @Test
    public void test1(){
        System.out.println("b".matches("b"));
    }
    @Test
    public void test2(){
        System.out.println("\\".matches("\\\\"));
    }
    @Test
    public void test3(){
        System.out.println("\t".matches("\t"));
    }
    @Test
    public void test4(){
        System.out.println("\r\n".matches("\r\n"));
    }
    @Test
    public void test5(){
        System.out.println("ab".matches("abc"));
        System.out.println("a".matches("abc"));
    }
    @Test
    public void test6(){
        System.out.println("ab".matches("[^abc]"));
        System.out.println("d".matches("[^abc]"));
    }
    @Test
    public void test7() {
        System.out.println("r".matches("[a-zA-Z]"));
    }
    @Test
    public void test8() {
        System.out.println("6".matches("[0-9]"));
        System.out.println("我".matches("[0-9]"));
    }
    @Test
    public void test9() {
        System.out.println("6".matches("[a-zA-Z_0-9]"));
    }
    @Test
    public void test10() {
        System.out.println("5".matches("."));
        System.out.println(".".matches("."));
    }
    @Test
    public void test11() {
        System.out.println("9".matches("\\d"));
    }
    @Test
    public void test12() {
        System.out.println("_".matches("\\w"));//相当于`[a-zA-Z_0-9]`
    }
}
